function moveOption(left, right) {
	var e1 = document.getElementById(left);
	var e2 = document.getElementById(right);

	for (var i = 0; i < e1.options.length; i++) {
		if (e1.options[i].selected) {
			var e = e1.options[i];
			e2.options.add(new Option(e.text, e.value));
			e1.remove(i);
			i = i - 1
		}
	}
	document.getElementById('result').value = getvalue(document
			.getElementById('right'));
}
function getvalue(geto) {
	// var allvalue = "";
	// for(var i=0;i<geto.options.length;i++){
	// allvalue +=geto.options[i].value + ",";
	// }
	var resultArray = new Array();
	for (var i = 0; i < geto.options.length; i++) {
		resultArray.push(geto.options[i].value);
	}
	return resultArray.join();
}
function changepos(oID, index) {
	var obj = document.getElementById(oID);
	if (index == -1) {
		if (obj.selectedIndex != -1) {
			if (obj.selectedIndex > 0) {
				obj.options[obj.selectedIndex]
						.swapNode(obj.options[obj.selectedIndex - 1]);
				document.getElementById('result').value = getvalue(document
						.getElementById('right'));
			}
		} else {
			alert("请至少选择一个已选择排序方式");
		}
	} else if (index == 1) {
		if (obj.selectedIndex != -1) {
			if (obj.selectedIndex < obj.options.length - 1) {
				obj.options[obj.selectedIndex]
						.swapNode(obj.options[obj.selectedIndex + 1]);
				document.getElementById('result').value = getvalue(document
						.getElementById('right'));
			}
		} else {
			alert("请至少选择一个已选择排序方式");
		}
	}
	obj.focus();
	return false;
}
function gototop(oID) {
	var obj = document.getElementById(oID);
	if (obj.multiple) {
		if (obj.selectedIndex != -1) {
			for (var selIndex = 0; selIndex < obj.options.length; selIndex++) {
				if (obj.options[selIndex].selected) {
					var transferIndex = selIndex;
					while (transferIndex > 0
							&& !obj.options[transferIndex - 1].selected) {
						obj.options[transferIndex]
								.swapNode(obj.options[transferIndex - 1]);
						transferIndex--;
					}
					document.getElementById('result').value = getvalue(document
							.getElementById('right'));
				}
			}
		} else {
			alert("请至少选择一个已选择排序方式");
		}
	} else {
		if (obj.selectedIndex != -1) {
			var selIndex = obj.selectedIndex;
			while (selIndex > 0) {
				obj.options[selIndex].swapNode(obj.options[selIndex - 1]);
				selIndex--;
			}
			document.getElementById('result').value = getvalue(document
					.getElementById('right'));
		} else {
			alert("请至少选择一个已选择排序方式");
		}
	}
	obj.focus();
	return false;
}
document.getElementById('result').value = getvalue(document.getElementById('right'));